// Author: Ivan Kazmenko (gassa@mail.ru)
module solution;
import std.math;
import std.stdio;
import std.typecons;

immutable int dirs = 4;
immutable int [dirs] dx = [-1,  0, +1,  0];
immutable int [dirs] dy = [ 0, -1,  0, +1];

struct Point
{
	int x;
	int y;
}

Point transform (Point a)
{
	return Point (((a.x - a.y) & ~1) / 2, a.y);
}

void main ()
{
	Point p, q;
	while (readf (" %s %s %s %s", &p.x, &p.y, &q.x, &q.y) > 0)
	{
		Point [] r;
		int [Point] d;

		void add (Point z, int dist)
		{
			if (z in d)
			{
				return;
			}
			d[z] = dist;
			r ~= z;

			auto tz = transform (z);
			for (int dir = 0; dir < dirs; dir += 2)
			{
				auto w = Point (z.x + dx[dir], z.y + dy[dir]);
				if (transform (w) == tz)
				{
					d[w] = dist;
					r ~= w;
				}
			}
		}

		add (p, 0);
		while (q !in d)
		{
			auto v = r[0];
			auto tv = transform (v);
			int cur = d[v];
			r = r[1..$];
			r.assumeSafeAppend ();

			foreach (dir; 0..dirs)
			{
				auto u = Point (v.x + dx[dir], v.y + dy[dir]);
				add (u, cur + 1);
			}
		}
		writeln (d[q]);
	}
}
